$(function(){
  let form = layui.form;
  let layer = layui.layer
  initUserInfo()
  function initUserInfo(){
    // form.val("user_info",{
    //   username:"1986755121",
    //   pwd:"123456"
    // })
    form.verify({
      username:function(value,  item){
        if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
          return '用户名不能有特殊字符';
        }
      }
    })
  }
  
  $(".layui-form").on("submit",function(e){
    e.preventDefault();
    let data = form.val("user_info")
    console.log(data);
  })

  $("#btn_exit").on("click",function(){
    let index = layer.confirm('是否确认退出?', {icon: 3, title:'提示'}, function(index){
      //do something
      location.href="http:www.baidu.com"
      
      layer.close(index);
    });
  })

})